<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .container{
            width: 300px;
            height: 600px;
            background-color: white;
            border-radius: 5px;
            padding: 5px 15px;
        }

        .header {
            border-bottom: 1px solid #ccc;
        }

        body{
            background-color: #ccc;
        }

    </style>
</head>

<body>
    <!-- 需要给组件传递html代码，用到插槽 -->
    <div id='app'>
        <card>
           <div style="color:red">登录</div>
        </card>
    </div>

    <template id="cardTemp">
        <div class="container">
            <div class="header">
                <!-- <h3>标题</h3> -->
                <!-- slot这个标签放置的位置，就是渲染组件内部html的位置 -->
                <slot></slot>
            </div>
            <div class="body">
                内容。。。
            </div>
        </div>
    </template>

    <script>

        const card = {
            template: '#cardTemp'
        }


        const vm = new Vue({
            el: '#app',
            data: {},
            components: {
                card
            }
        })
    </script>
</body>

</html>